home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <winb.h>
- #include <te.h>
- #include <fntb.h>
- #include <gui.h>
- #include <egb.h>
- #include <guidbg.h>
-
- int dialogID = -1 ;
- int messageID[12] = -1 ;
- int taskButtonID[11] = -1 ;
- int dialogMenuID = -1 ;
- int topMenuItemID[3] = -1 ;
- int topMenuID[4] = -1 ;
- int MenuItemID[9] = -1 ;
- int quitIconID = -1 ;
- int aboutDialogID = -1 ;
- int aboutMessageID[5] = -1 ;
- int aboutDButtonID = -1 ;
- int dialogBaseHyperID = -1 ;
- int sourceMenuID = -1 ;
- int sourceMenuItemID = -1 ;
- int commandDialogID = -1 ;
- int commandfileDButtonID = -1 ;
- int commandExecDButtonID = -1 ;
- int commandFileNameTextID = -1 ;
- int commandQuitIconID = -1 ;
- int commandMessageID[2] = -1 ;
- int commandReturnExecDButtonID = -1 ;
-
- #include <file_dlg.h>
- #include <eintm.h>
-
- //#define DEBUG
-
- int fdlgFunc(char *);
-
- //extern char *taskListMsg[] ;
- extern int taskOldID[] ;
- //extern int taskOldCount ;
- extern int taskListUpdateFlag ;
- extern int *apliID; //アプリに対応するメニューアイテムID
- extern int *apliMode; //アプリMODE
- extern char *apliPath; //アプリパス
- extern int *apliSaveFlag; //アプリ退避フラグ(TRUE:退避中)
- extern int apliNum; //登録アプリ数
- //extern void upDateTaskList(void);
- extern void restartEXG(void);
- extern char *buf;
-
- char *aboutMsg;
-
- int aboutFlag = FALSE ;
- int alertClass=0;
- int alertobj[3] ;
-
- extern int quitFuncRet ;
- extern int taskFlag;
-
- /* initDataSRCGUI:sourceMenuItemID:MJ_MITEML40の呼び出し関数 */
- int apliMenuExecFunc(kobj, messId, argc, pev, trigger)
- int kobj ;
- int messId ;
- int argc ;
- EVENT *pev ;
- int trigger ;
- {
- int i,j,k;
- int n,id;
-
- for(i=0;apliID[i]!=kobj;i++) ;
-
- #ifdef DEBUG
- printf("menuItemID=%d\napliMode =%d\napliPath =%s\n",
- apliID[i],apliMode[i],&(apliPath[i*128]));
- #endif
-
- // EXGを退避
- if(apliMode[i]==2 || apliMode[i]==3 || apliMode[i]==5 || apliMode[i]==6)
- {
- if(apliMode[i]==3 || apliMode[i]==6) n=2; else n=1;
- for(j=0;j<apliNum;j++)
- if(apliMode[j]<n)
- {
- EIN_fnameNonDirectory(&(apliPath[j*128]),buf);
- k=MMI_CallMessage(MMI_GetApliId(),GM_QUERYID,
- QM_SAMEAS,( int )buf);
- if(k>0)
- {
- apliSaveFlag[j] = TRUE;
- MMI_CallMessage( k, GM_QUIT, 0, 0 );
- }
- }
- }
-
- if(apliMode[i]<4)
- { // EXG起動
- apliSaveFlag[i] = FALSE;
- MMI_CallMessage(MMI_GetApliId(),GM_INVOKE,TRUE,
- (int)&(apliPath[i*128]));
- } else
- if(apliMode[i]<7)
- { // オーバーレイEXP起動(同じディレクトリのGL.EXG経由)
- j=i*128;
- MMI_CallMessage(MMI_GetApliId(),GM_QUERYID,QM_DIRECTRY,( int )buf );
- for(i=0;buf[i]!='\0';i++) ;
- buf[i ] = 'G';
- buf[i+ 1] = 'L';
- buf[i+ 2] = '.';
- buf[i+ 3] = 'E';
- buf[i+ 4] = 'X';
- buf[i+ 5] = 'G';
- buf[i+ 6] = ' ';
- i+=7;
- for(k=0;apliPath[j+k]!='\0';k++) buf[i+k] = apliPath[j+k];
- buf[i+k]='\0';
- #ifdef DEBUG
- printf("EXP overray:%s\n",buf);
- #endif
- MMI_CallMessage(MMI_GetApliId(),GM_INVOKE,TRUE,(int)buf);
- } else
- { // EXP・EXE・COM・BAT起動
- #ifdef DEBUG
- printf("EXP・EXE・COM・BAT:%s\n",&(apliPath[i*128]));
- #endif
- system(&(apliPath[i*128]));
- }
-
- return NOERR ;
- }
-
- void setAlertObj(int targetobj)
- {
- alertobj[alertClass] = MMI_GetAlertObj(); // 現在のALERTOBJを退避
- ++alertClass;
- MMI_SetAlertObj( targetobj ) ;
-
- return ;
- }
-
- void resetAlertObj()
- {
- --alertClass;
- MMI_SetAlertObj( alertobj[alertClass] ) ; // ALERTOBJを元に戻す
- return ;
- }
-
- /* initDataGUI:MenuItemID[6]:MJ_MITEML40の呼び出し関数 */
- int execFunc(kobj, messId, argc, pev, trigger)
- int kobj ;
- int messId ;
- int argc ;
- EVENT *pev ;
- int trigger ;
- {
- //つないで表示
- MMI_SendMessage(commandDialogID ,MM_ATTACH , 1, dialogBaseHyperID);
- MMI_SendMessage(commandFileNameTextID ,MM_WAKE ,0 );
- MMI_SendMessage(commandDialogID ,MM_SHOW , 0);
- setAlertObj(commandDialogID);
-
- return NOERR ;
- }
-
- // ファイルダイアログ処理関数
- // 呼び出すとファイルダイアログを表示してパス名を取得
- int fdlgFunc(PathName)
- char *PathName ; // パス名を格納する配列
- {
- static char *ExtStr[]={"*.*",NULL} ;
- // ワイルドカードの指定
- unsigned int MSlctCnt ; // 選択されたファイル数
- int Atr ; // ファイル属性 (未使用)
- int ret ;
-
- // ファイルダイアログの表示
- #ifdef DEBUG
- printf("ファイルダイアログ表示\n");
- #endif
- ret=FDG_DspFileDlg(dialogBaseHyperID,
- FDG_NONE|FDG_ALERT|FDG_REDRAW|FDG_TEXT
- , NULL,ExtStr, &MSlctCnt) ;
- if (ret && MSlctCnt > 0)
- { // "読込"か"保存"が押されたならファイル名を取得する
- #ifdef DEBUG
- printf("ファイル名取得完了\n");
- #endif
- FDG_GetPathName(PathName, &Atr, 0) ;
- } else
- { // "取消"が押されたか1つもファイルが選択されなかった場合は
- // ファイル名を取得しないで終了する
- ret = 0 ;
- }
-
- //テキストWAKE
- MMI_SendMessage(commandFileNameTextID ,MM_WAKE ,0 );
-
- return ret ;
- }
-
- /* initDataGUI:MenuItemID[5]:MJ_MITEML40の呼び出し関数 */
- int restartEXGFunc(kobj, messId, argc, pev, trigger)
- int kobj ;
- int messId ;
- int argc ;
- EVENT *pev ;
- int trigger ;
- {
- restartEXG();
- return NOERR ;
- }
-
- /* initDataGUI:taskButtonID[0]:MJ_BUTTONL40の呼び出し関数 */
- /* initDataGUI:taskButtonID[1]:MJ_BUTTONL40の呼び出し関数 */
- /* initDataGUI:taskButtonID[2]:MJ_BUTTONL40の呼び出し関数 */
- /* initDataGUI:taskButtonID[3]:MJ_BUTTONL40の呼び出し関数 */
- /* initDataGUI:taskButtonID[4]:MJ_BUTTONL40の呼び出し関数 */
- /* initDataGUI:taskButtonID[5]:MJ_BUTTONL40の呼び出し関数 */
- /* initDataGUI:taskButtonID[6]:MJ_BUTTONL40の呼び出し関数 */
- /* initDataGUI:taskButtonID[7]:MJ_BUTTONL40の呼び出し関数 */
- /* initDataGUI:taskButtonID[8]:MJ_BUTTONL40の呼び出し関数 */
- /* initDataGUI:taskButtonID[9]:MJ_BUTTONL40の呼び出し関数 */
- /* initDataGUI:taskButtonID[10]:MJ_BUTTONL40の呼び出し関数 */
- int taskButtonFunc(kobj, messId, argc, pev, trigger)
- int kobj ;
- int messId ;
- int argc ;
- EVENT *pev ;
- int trigger ;
- {
- int i;
-
- #ifdef DEBUG
- printf("taskIDlist-----------\n");
- for(i=0;i<10;i++) printf("%dID=%d\n",i,taskOldID[i]);
- #endif
-
- for(i=0;(taskButtonID[i]!=kobj) && (i<11);i++);
-
- #ifdef DEBUG
- printf("select=%d(%d)\n",i,taskOldID[i]);
- #endif
-
- if(i==10)
- {
- #ifdef DEBUG
- printf("show task list\n");
- #endif
- MMI_CallMessage(MMI_GetApliId(), GM_TASKLIST, 0, 0 );
- } else
- if((trigger & MS_EVKEYONL40) || (trigger & MS_BTLEFTL40))
- MMI_CallMessage(MMI_GetApliId(),GM_SWITCH,FALSE, taskOldID[i] );
- else
- {
- MMI_CallMessage( taskOldID[i] ,GM_QUIT, 0, 0 );
- taskListUpdateFlag=ENABLE ;
- taskFlag=0;
- }
-
- return NOERR ;
- }
-
- /* initDataGUI:MenuItemID[0]:MJ_MITEML40の呼び出し関数 */
- int showAboutFunc(kobj, messId, argc, pev, trigger)
- int kobj ;
- int messId ;
- int argc ;
- EVENT *pev ;
- int trigger ;
- {
- sprintf(aboutMsg,"%d bytes free",EIN_checkMem());
- //ベースダイアログを選択不可にする
- //つないで表示
- MMI_SendMessage(aboutDialogID ,MM_ATTACH , 1, dialogBaseHyperID);
- MMI_SendMessage(aboutDialogID ,MM_SHOW , 0);
- setAlertObj(aboutDialogID);
-
- aboutFlag = TRUE ;
- return NOERR ;
- }
-
- /* initDataGUI:MenuItemID[8]:MJ_MITEML40の呼び出し関数 */
- int packFunc(kobj, messId, argc, pev, trigger)
- int kobj ;
- int messId ;
- int argc ;
- EVENT *pev ;
- int trigger ;
- {
- return NOERR ;
- }
-
- /* initDataABOUTGUI:aboutDButtonID:MJ_DBUTTONL40の呼び出し関数 */
- int aboutQuitFunc(kobj, messId, argc, pev, trigger)
- int kobj ;
- int messId ;
- int argc ;
- EVENT *pev ;
- int trigger ;
- {
- //消去して外す
- MMI_SendMessage(aboutDialogID ,MM_ERASE , 0);
- MMI_SendMessage(aboutDialogID ,MM_DETACH , 0);
- //ベースダイアログを選択可にする
- resetAlertObj();
-
- aboutFlag = FALSE ;
- return NOERR ;
- }
-
- /* initDataGUI:MenuItemID[2]:MJ_MITEML40の呼び出し関数 */
- /* initDataGUI:quitIconID:MJ_ICONL40の呼び出し関数 */
- int quitFunc(kobj, messId, argc, pev, trigger)
- int kobj ;
- int messId ;
- int argc ;
- EVENT *pev ;
- int trigger ;
- {
- MMI_SetHaltFlag(TRUE);
- quitFuncRet = NOERR ;
-
- return NOERR ;
- }
-
- //-----------==================================----------------
-
- /* initDataCMNDGUI:commandfileDButtonID:MJ_DBUTTONL40の呼び出し関数 */
- int commandFileDialogFunc(kobj, messId, argc, pev, trigger)
- int kobj ;
- int messId ;
- int argc ;
- EVENT *pev ;
- int trigger ;
- {
- #ifdef DEBUG
- printf("to fdlgFunc\n");
- #endif
- if (fdlgFunc(buf) == 0)
- {
- #ifdef DEBUG
- printf("何も選択されてない\n");
- #endif
- return NOERR ;
- }
-
- #ifdef DEBUG
- printf("テキストに設定\n");
- #endif
- MMI_SendMessage( commandFileNameTextID, MM_SETTEXT, 3,buf, 127,TRUE);
- MMI_SendMessage( commandFileNameTextID, MM_SHOW,0);
-
- return NOERR ;
- }
-
- /* initDataCMNDGUI:commandExecDButtonID:MJ_DBUTTONL40の呼び出し関数 */
- int commandExecFunc(kobj, messId, argc, pev, trigger)
- int kobj ;
- int messId ;
- int argc ;
- EVENT *pev ;
- int trigger ;
- {
- char buf2[128];
- char ext[4];
- int i,k;
-
- MMI_SendMessage( commandFileNameTextID, MM_GETTEXT, 3,buf, 127,FALSE);
-
- //消去して外す
- MMI_SendMessage(commandDialogID ,MM_ERASE , 0);
- MMI_SendMessage(commandDialogID ,MM_DETACH , 0);
- //ベースダイアログを選択可にする
- resetAlertObj();
-
- //拡張子を調べて起動する
- for(i=0;buf[i]!='\0' && buf[i]!=' ';i++) buf2[i] = buf[i];
- buf2[i] = '\0';
- ext[0]='\0';
- EIN_fnameExt( buf2, ext );
- #ifdef DEBUG
- ext[3]='\0';
- printf("拡張子:%s(%s)\n",ext,buf2);
- #endif
-
- if(ext[0]=='E' && ext[1]=='X' && ext[2]=='G')
- {
- #ifdef DEBUG
- printf("EXG起動\n");
- #endif
- MMI_CallMessage(MMI_GetApliId(),GM_INVOKE,TRUE,
- (int)buf);
- } else
- if(ext[0]=='E' && ext[1]=='X' && ext[2]=='P')
- {
- MMI_CallMessage(MMI_GetApliId(),GM_QUERYID,QM_DIRECTRY,( int )buf2 );
- for(i=0;buf2[i]!='\0';i++) ;
- buf2[i ] = 'G';
- buf2[i+ 1] = 'L';
- buf2[i+ 2] = '.';
- buf2[i+ 3] = 'E';
- buf2[i+ 4] = 'X';
- buf2[i+ 5] = 'G';
- buf2[i+ 6] = ' ';
- i+=7;
- for(k=0;buf[k]!='\0';k++) buf2[i+k] = buf[k];
- buf2[i+k] = '\0';
- #ifdef DEBUG
- printf("EXP overray:%s\n",buf2);
- #endif
- MMI_CallMessage(MMI_GetApliId(),GM_INVOKE,TRUE,(int)buf2);
- } else
- { // EXE・COM・BAT・COMMAND起動
- #ifdef DEBUG
- printf("EXE・COM・BAT・COMMAND:%s\n",buf);
- #endif
- system(buf);
- }
-
- MMI_SendMessage( commandFileNameTextID, MM_SETTEXT, 3,NULL, 0,FALSE);
-
- return NOERR ;
- }
-
- /* initDataCMNDGUI:commandQuitIconID:MJ_ICONL40の呼び出し関数 */
- int commandQuitFunc(kobj, messId, argc, pev, trigger)
- int kobj ;
- int messId ;
- int argc ;
- EVENT *pev ;
- int trigger ;
- {
- MMI_SendMessage( commandFileNameTextID, MM_SETTEXT, 3,NULL, 0,FALSE);
-
- //消去して外す
- MMI_SendMessage(commandDialogID ,MM_ERASE , 0);
- MMI_SendMessage(commandDialogID ,MM_DETACH , 0);
- //ベースダイアログを選択可にする
- resetAlertObj();
-
- return NOERR ;
- }
-